package com.coolingme.dynamicproxy.jdkproxy;

/**
 * jdk动态代理测试
 *
 * @author wangyue
 * @date 2020/9/30 14:52
 */
public class Test {

    public static void main(String[] args) {
        JDkMatchMaker jDkMatchMaker = new JDkMatchMaker();

        IPerson richMan = jDkMatchMaker.getInstance(new RichMan());

        // 同一个接口的所有方法，都会触发代理方法
        richMan.findLove();

        richMan.getName(1);

        System.out.println(richMan.toString());

//        IPerson honestMan = jDkMatchMaker.getInstance(new HonestMan());
//        honestMan.findLove();
//
//        IPerson poolMan = jDkMatchMaker.getInstance(new PoolMan());
//        poolMan.findLove();
    }

}
